<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:forEach items="${channelList}" var="value">
    <c:if test="${value.channel_short == channelShort}">
        <c:set value="${value}" var="channel" />
    </c:if>
</c:forEach>
<!--content-list-wrap-->
<div class="content-list-wrap">
    <div class="mui-content mui-scroll-wrapper" id="contentListWrap">
        <div class="mui-scroll">
            <div class="inner-list">
                <div id="contentList">
                    <script type="text/html" id="tplList">
                        {{each resultList.list as value i}}
                        <div class="mui_comm">
                            <div class="mui_comm_head">
                                <div class="comm_logo">
                                    <img src="{{if value.head_url}}{{value.head_url}}{{/if}}{{if !value.head_url}}wjz/images/logo_03.png{{/if}}" />
                                </div>
                                <div class="comm_title">
                                    <a><h4>{{value.unit_name}}</h4></a>
                                    <p>{{dataFormat(value.publish_time,'yyyy/MM/dd hh:mm')}}</p>
                                </div>
                            </div>
                            <div class="mui_comm_list" data-id="{{value.id}}">
                                <p>{{#value.content}}</p>
                            </div>
                            <div class="mui_comm_pics" >
                                {{if parseJson(value.pic).length == 1}}
                                {{each parseJson(value.pic) as pics j}}
                                    <img src="{{pics.pic}}" data-preview-src="" data-preview-group="{{value.id}}"/>
                                {{/each}}
                                {{else}}
                                <div class="sudoku">
                                {{each parseJson(value.pic) as pics j}}
                                    <div class="multi"><img src="{{pics.pic}}" data-preview-src="" data-preview-group="{{value.id}}"/></div>
                                {{/each}}
                                </div>
                                {{/if}}

                            </div>
                            <div class="mui_comm_num">
                                <span>{{value.fabulous_num}} 赞</span>
                                <span>{{value.comment_num}} 评论</span>
                            </div>
                            <div>
                                <ul class="mui_comm_ul">
                                    <li class="mui_comm_li left" data-id="{{value.id}}">
                                        <span class="up {{if value.is_up == 1}}hover{{/if}}">赞</span>
                                    </li>
                                    <li class="mui_comm_li right" data-id="{{value.id}}" id="comment">
                                        <span class="comment">评论</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        {{/each}}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="nav_show.jsp" />
<script>

    function loadData() {
        $.ajax({
            url: _basePath + "/app/community/list",
            data: {
                channel_id: '${channelId}',
                type: 2
            },
            dataType: 'json',
            success: function (data) {
                if(undefined != typeof data.resultList && data.resCode == 0) {
                    var _html = template('tplList', data);
                    $("#contentList").append(_html);
                }else {
                    mui.toast(data['message']);
                }
            }
        });

    }

    $(function(){

        loadData();
    });

</script>